//
//  ViewController.m
//  UI02_UIImageView
//
//  Created by aaaaaa on 16/6/6.
//  Copyright © 2016年 dllo. All rights reserved.
//

#import "ViewController.h"

@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];

    [self crateImageView];
    [self createAnimationImage];
}

- (void)crateImageView {
    //创建图片对象
    //如果是png格式的图片可以省略后缀.png 其他图片不可以省略
    UIImage *image = [UIImage imageNamed:@"BackGround.png"];
    //创建图片视图
    UIImageView *backgroundImageView = [[UIImageView alloc] initWithImage:image];
//    backgroundImageView.frame = self.view.frame;
    backgroundImageView.frame = [UIScreen mainScreen].bounds;
    [self.view addSubview:backgroundImageView];
    [backgroundImageView release];
}

- (void)createAnimationImage{
    
    UIImageView *imageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"BZombie1.tiff"]];
    imageView.frame = CGRectMake(200, 100, 205, 163);
    [self.view addSubview:imageView];
    [imageView release];
    
    NSMutableArray *imageArray = [NSMutableArray arrayWithArray:0];
    
    for (int i = 1; i <= 25; i++) {
        NSString *name = [NSString stringWithFormat:@"BZombie%d.tiff", i];
        UIImage *image = [UIImage imageNamed:name];
        [imageArray addObject:image];
    }
    
    //指定动画所用到的一组图片
    imageView.animationImages = imageArray;
    //指定动画的循环次数
    imageView.animationRepeatCount = 0;
    //指定动画所需要的时间
    imageView.animationDuration = 25 * 0.1;
    //开始动画
    [imageView startAnimating];
}









- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}



















@end
